package org.nepu.sc.domain;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.nepu.sc.converter.DataVOConverter;

import javax.persistence.Column;
import javax.persistence.Convert;
import java.util.List;

@Data
@ApiModel(value = "风险结果")
public class RiskResult {

    @ApiModelProperty(value = "评价指标")
    String rateId;


    @ApiModelProperty(value = "评价参数")
    DataVO rateParamss;

    @ApiModelProperty(value = "评价名称")
    String rateName;

    @ApiModelProperty(value = "风险等级")
    String riskLevel;

    @ApiModelProperty(value = "风险得分")
    Double riskScore;

    @ApiModelProperty(value = "参数列表")
    List<RiskResult> params;

    // 比例 矩阵
    @ApiModelProperty(value = "计算方式")
    String method;

    public RiskResult(double score){
        this.riskScore = score;
        if (score >= 0.9){
            this.riskLevel = "低风险";
        }
        else if (score >= 0.8){
            this.riskLevel = "低风险";
        }else if (score >= 0.6){
            this.riskLevel = "一般风险";
        }else if (score >= 0.4){
            this.riskLevel = "较大风险";
        }else if (score >= 0.0){
            this.riskLevel = "重大风险";
        }else{
            this.riskScore = 0.0;
            this.riskLevel = "重大风险";
        }
    }

    public RiskResult(){

    }
}
